home *** CD-ROM | disk | FTP | other *** search
/ Aminet 32 / Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso / Aminet / dev / lang / Python151.lha / Python-1.5 / Install_Python < prev    next >
Text File  |  1998-11-15  |  14KB  |  386 lines

  1. ;------------------------------------------------------------------------
  2. ;
  3. ; Python Installation script for Python version 1.5
  4. ;
  5. ; Copyright © Irmen de Jong.
  6. ; V2.6 (15-nov-98)
  7. ;
  8.  
  9. (set OSVersion          (/ (getversion) 65536))
  10.  
  11. (set cpu (database "cpu"))
  12.  
  13. (set @app-name "Python 1.5")
  14.  
  15. (set #source-dir (pathonly @icon) )
  16.  
  17. ;
  18. ; ENGLISH STRINGS
  19. ;
  20. (set #osmsg "ARGH! You have an obsolete Kickstart version!\n\nPython only works on Kickstart 2.04 or higher. Upgrade to 3.1!")
  21. (set #nopretendmsg "Can only install for real.")
  22. (set #updatemsg "This will install a fresh copy of Python 1.5.1.\nIf you already have installed the previous version, you might consider running the Update_Previous script instead.\nIf so, abort this installation now.")
  23. (set #welcomemsg "Installation of Python 1.5.1\n\nA new directory (with icon) will be created, in which the program is installed.")
  24. (set #oldversionmsg "\nDo you have a previous installed version, and if so, do you want to delete that (fully)?\nWARNING: If you select 'yes', the full contents of the directory of the old version will be deleted!\n\n\n(If you have a previous version installed, and you don't delete it, you must install this new version to a new directory)")
  25. (set #oldversionhelp "Yes: delete all files from old version. You can then install this new version in the place of the old one, otherwise, you'll have to install this version in a new directory.\n\nIf you have any files in the directory of the old version that you want to keep, SELECT 'NO'!")
  26. (set #whereisold "Where is your previous release installed?")
  27. (set #deleteoldmsg "\nWill now delete old version. Last chance to keep old data!")
  28. (set #willdeletemsg "\nWill now delete drawer\n\n%s\n\ncompletely.")
  29. (set #willdeletehelp "Last chance to keep old files: click 'Abort'!")
  30. (set #deleteworkmsg "Deleting %s...")
  31. (set #oldversion "old version")
  32. (set #deleteinstall "Do you want to delete the installation directory?\n\n(it is no longer needed)")
  33. (set #installationfiles "installation files")
  34. (set #whereprompt "Were must Python be installed? Most of the files don't have to be copied, if you accept the offered default.")
  35. (set #wherehelp "  Here you can specify the location where to install Python.\n  Installation can be made on-place. This is recommended if you have already unarchived the Python archive to its final location. In this case most of the files are left where they are. Only necessary files are moved to different positions.\n  If you choose another location, a new subdirectory will be created (with icon) in which the program is installed.")
  36. (set #currentmsg "\nInstalling Python to\n\n%s\n\n(the current place)")
  37. (set #existingerr "Can't install into existing directory!")
  38. (set #oldstillexistserr "Couldn't fully remove old drawer! (is it still in use?)")
  39. (set #newmsg "\nInstalling Python to\n\n%s\n\n(a new directory)" )
  40. (set #whichprompt "Which version of the program should be installed?")
  41. (set #whichhelp "Choose the version which matches your CPU/FPU configuration best.\nRead the README file for info on how to obtain other versions.\n\n")
  42. (set #startupprompt "The following commands will be added to your \"S:User-Startup\" file (You'll need them to run Python):\n\nASSIGN Python: %s\nPATH Python: ADD\n")
  43. (set #readmemsg (cat "Please read shown information...\n\n\n(It is also wise to read the README file)"))
  44. (set #ver_68020_IEEE "Python  68020, no FPU")
  45. (set #ver_68030_882  "Python  68030, 68882 FPU")
  46. (set #sorryno020 "Sorry, there is no longer a 020/IEEE version included. You should really upgrade to at least a 68030 with a FPU...")
  47. (set #abort "Abort")
  48. (set #proceed "Proceed")
  49. (set #endmsg "\nPython 1.5.1 is now installed!\n\nIf you're using NewIcons, take a look in the Icons directory. NewIcon versions of the icons are available there.")
  50. ;
  51. ; NEDERLANDSE STRINGS
  52. ;
  53. (if (= @language "nederlands")
  54. (
  55. (set #osmsg "ARGH! U heeft een verouderde Kickstart versie!\n\nPython werkt alleen op Kickstart 2.04 of nieuwer. Upgrade naar 3.1!")
  56. (set #nopretendmsg "Kan alleen echte installatie uitvoeren.")
  57. (set #updatemsg "Er zal een nieuwe installatie van Python 1.5.1 plaatsvinden.\nAls u al een vorige versie heeft geïnstalleerd, is het aan te raden om het Update_Previous script te gebruiken inplaats van dit installatieprogramma.\nAls u dat wilt, moet u nu deze installatie afbreken.")
  58. (set #welcomemsg "Installatie van Python 1.5.1\n\nEr wordt een nieuwe lade (met ikoon) aangemaakt, waarin het programma wordt geïnstalleerd.")
  59. (set #oldversionmsg "\nHeeft u een vorige versie geïnstalleerd, en zo ja, wilt u deze dan (in zijn geheel) verwijderen?\nWAARSCHUWING: als u 'ja' kiest, wordt de complete inhoud van de lade van de oude versie gewist!\n\n\n(Als u een vorige versie geïnstalleerd heeft, en deze niet verwijdert, moet u de nieuwe versie in een nieuwe lade installeren)")
  60. (set #oldversionhelp "Ja: verwijder alle files van de oude versie. U kunt dan deze nieuwe versie op de plaats van de oude installeren, anders moet u dat in een nieuwe lade doen.\n\nAls u files heeft in de lade van de oude versie die u wilt bewaren, KIES DAN 'NEE'!")
  61. (set #whereisold "Waar is uw vorige versie geïnstalleerd?")
  62. (set #deleteoldmsg "\nOude versie wordt nu verwijderd. Laatste kans om oude files te bewaren!")
  63. (set #willdeletemsg "\nDe lade\n\n%s\n\nwordt in zijn geheel verwijderd.")
  64. (set #willdeletehelp "Laatste kans om oude files te bewaren: klik 'Stop'!")
  65. (set #deleteworkmsg "%s wordt verwijderd...")
  66. (set #oldversion "Oude versie")
  67. (set #deleteinstall "Wilt u de installatie-lade verwijderen?\n\n(die is niet langer nodig)")
  68. (set #installationfiles "Installatie files")
  69. (set #whereprompt "Waar moet Python geïnstalleerd worden? De meeste files hoeven niet gekopiëerd te worden, als u de standaard keuze accepteert.")
  70. (set #wherehelp "  Hier kunt u de lokatie van Python opgeven.\n  De installatie kan ter plekke plaatsvinden. Dit is aanbevolen als u de Python archive al in de juiste plaats heeft uitgepakt. In dit geval worden de meeste files met rust gelaten. Slechts een paar files worden naar hun benodigde lokatie gekopiëerd.\n  Als u een andere lokatie kiest, wordt een nieuwe lade (met ikoon) aangemaakt, waarin Python wordt geïnstalleerd.")
  71. (set #currentmsg "\nInstalleren van Python in\n\n%s\n\n(de huidige plaats)")
  72. (set #existingerr "Kan niet in bestaande lade installeren!")
  73. (set #oldstillexistserr "Kan oude lade niet volledig verwijderen! (wordt hij nog gebruikt?)")
  74. (set #newmsg "\nPython wordt geïnstalleerd in\n\n%s\n\n(een nieuwe lade)" )
  75. (set #whichprompt "Welke versie van het programma moet geïnstalleerd worden?")
  76. (set #whichhelp "Kies de versie die het beste bij uw CPU/FPU configuratie past.\nLees het README bestand voor informatie over hoe andere versies te verkrijgen.\n\n")
  77. (set #startupprompt "De volgende commando's zullen aan uw \"S:User-Startup\" bestand worden toegevoegd (ze zijn nodig om Python te kunnen gebruiken):\n\nASSIGN Python: %s\nPATH Python: ADD\n")
  78. (set #readmemsg (cat "Leest u AUB de getoonde informatie...\n\n\n(Het is ook verstandig om de README file te lezen)"))
  79. (set #ver_68020_IEEE "Python  68020, geen FPU")
  80. (set #ver_68030_882  "Python  68030, 68882 FPU")
  81. (set #sorryno020 "Sorry, er is niet langer een 020/IEEE versie meegeleverd. U moet echt eens upgraden naar tenminste een 68030 en FPU...")
  82. (set #abort "Stop")
  83. (set #proceed "Ga verder")
  84. (set #endmsg "\nPython 1.5.1 is nu geïnstalleerd!\n\nAls u NewIcons gebruikt, kijk dan eens in de Icons directory. Hier zijn NewIcon versies van de icons beschikbaar.")
  85. )
  86. )
  87.  
  88. ;------------------------------------------------------------------------
  89. ;;;;
  90. ;;;; Subroutines follow below:
  91. ;;;;
  92.  
  93. ;;;;
  94. ;;;; Check if OS version is good enough.
  95. ;;;;
  96. (procedure checkKick
  97.  (if (< OSVersion 37)
  98.     (message #osmsg)
  99.  )
  100. )
  101.  
  102. ;;;;
  103. ;;;; Find out which pager to use ($PAGER or sys:utilities/multiview)
  104. ;;;;
  105. (procedure installPager
  106.  (set pager-cmd
  107.    (if (exists "ENV:PAGER" (noreq)) (getenv "PAGER") ("SYS:Utilities/Multiview")
  108.    )
  109.  )
  110. )
  111.  
  112. ;;;;
  113. ;;;; Ask user if she wants to delete an old version.
  114. ;;;;
  115. (procedure removeOldversion
  116. (if (askbool 
  117.     (prompt #oldversionmsg)
  118.     (help #oldversionhelp)
  119.     )
  120.     (
  121.         (set oldreleasepath "Python:")
  122.         (set oldreleasepath (expandpath
  123.             (askdir
  124.                 (prompt #whereisold)
  125.                 (help "Select directory")
  126.                 (default "Python:")
  127.             ) )
  128.         )    
  129.  
  130.         (if (askbool
  131.             (prompt (#willdeletemsg oldreleasepath))
  132.             (help #willdeletehelp)
  133.             (choices #proceed #abort)
  134.             )
  135.             (
  136.                 (working (#deleteworkmsg #oldversion))
  137.                 (run "assign Python: remove")
  138.                 (run ("delete >NIL: %s %s.info FORCE ALL" oldreleasepath oldreleasepath))
  139.                 ;;; Check if indeed all stuff went to the bitbasket
  140.                     (if (exists oldreleasepath) (abort #oldstillexistserr))
  141.             )
  142.             (abort)
  143.         )
  144.     )
  145. )
  146. )
  147.  
  148. ;;;;
  149. ;;;; Select destination. Create drawer if necessary.
  150. ;;;;
  151. (procedure selectDestination
  152. (set destination
  153.     (askdir
  154.         (prompt #whereprompt)
  155.         (help #wherehelp)
  156.         (newpath)
  157.         (default #source-dir)
  158.     )
  159. )    
  160.  
  161. (set @default-dest destination)
  162.  
  163. (if (= #source-dir destination)
  164.     (
  165.         (set #otherdir FALSE)
  166.         (message (#currentmsg destination))
  167.     )
  168.     (
  169.         (set #otherdir TRUE)
  170.         (set tempdest destination)
  171.         (set destination (tackon destination "Python-1.5"))
  172.  
  173.         (if (exists destination) (abort #existingerr))
  174.  
  175.         (message (#newmsg destination))
  176.         (makedir destination)
  177.         (copyfiles
  178.         (source (tackon #source-dir "Icons/Drawer.info"))
  179.         (dest tempdest)
  180.         (newname "Python-1.5.info")
  181.         )
  182.     )
  183. )
  184. )
  185.  
  186. ;;;;
  187. ;;;; Choose the desired binary version.
  188. ;;;;
  189. (procedure chooseBinary
  190. (set prog 1)
  191. (if (= cpu "68000") (set prog 0))
  192. (if (= cpu "68010") (set prog 0))
  193. (if (= cpu "68020") (set prog 0))
  194. (if (= cpu "68030") (set prog 1))
  195. (if (= cpu "68040") (set prog 1))
  196.  
  197. ;;;; SORRY GUYS, ONLY A 030/882 VERSION NOW
  198. (if (= prog 0) (abort (#sorryno020)))
  199. (set which_version 1)
  200. ;;
  201. ;;
  202. ;;; Ask version of program
  203. ;;(set which_version
  204. ;;        (askchoice
  205. ;;                (prompt #whichprompt)
  206. ;;                (help #whichhelp @askoptions-help)
  207. ;;                (choices
  208. ;;            #ver_68020_IEEE
  209. ;;            #ver_68030_882
  210. ;;               )
  211. ;;                (default prog)
  212. ;;        )
  213. ;;)
  214. )
  215.  
  216. ;;;;
  217. ;;;; Install the correct Python binary.
  218. ;;;;
  219. (procedure installprog
  220.  (if #otherdir
  221.    (
  222.     (if (= which_version 0)             ; 68020
  223.       (
  224. ;;;; SORRY GUYS NO MORE 020/IEEE VERSION
  225.     abort (#sorryno020)
  226. ;;;;        (copyfiles
  227. ;;;;        (source (tackon #source-dir "Python_020_IEEE"))
  228. ;;;;        (dest destination)
  229. ;;;;        (newname "Python")
  230. ;;;;        )
  231.       )
  232.     )
  233.     (if (= which_version 1)             ; 68030+FPU
  234.       (
  235.         (copyfiles
  236.         (source (tackon #source-dir "Python_030"))
  237.         (dest destination)
  238.         (newname "Python")
  239.         )
  240.       )
  241.     )
  242.     (run ("delete >NIL: FORCE %s/python_#?" destination))
  243.    )
  244.    (
  245.     (if (= which_version 0)             ; 68020
  246. ;;;; SORRY GUYS NO MORE 020/IEEE VERSION
  247.     (abort (#sorryno020))
  248. ;;;;        (rename (tackon #source-dir "Python_020_IEEE") (tackon #source-dir "Python") )
  249.     )
  250.     (if (= which_version 1)             ; 68030+FPU
  251.         (rename (tackon #source-dir "Python_030") (tackon #source-dir "Python") )
  252.     )
  253.    )
  254.  )
  255. )
  256.  
  257.  
  258. ;;;;
  259. ;;;; Ask user if she wants to delete the installation drawer.
  260. ;;;;
  261. ;;;; BUG: hmm this doesnt work because installer keeps a lock in that drawer.
  262. ;;;;
  263. ;(procedure removeInstallation
  264. ;(if (askbool (prompt #deleteinstall) (help ""))
  265. ;    (
  266. ;    (working (#deleteworkmsg #installationfiles))
  267. ;    (message ("delete >NIL: %s %s.info FORCE ALL" #source-dir #source-dir))
  268. ;    (run ("delete >NIL: %s %s.info FORCE ALL" #source-dir #source-dir))
  269. ;    )
  270. ;)
  271. ;)
  272.  
  273.  
  274. ;------------------------------------------------------------------------
  275. ;;;;
  276. ;;;; Main installation sequence starts here
  277. ;;;;
  278.  
  279. (if (= @pretend 1)
  280.     (abort #nopretendmsg)
  281. )
  282.  
  283. (message #updatemsg)
  284. (message #welcomemsg)
  285.  
  286. (checkKick)
  287.  
  288. (installPager)
  289.  
  290. (complete 0)
  291.  
  292. (removeOldversion)
  293.  
  294. (complete 10)
  295.  
  296. (selectDestination)
  297.  
  298. (complete 25)
  299.  
  300. (chooseBinary)
  301.  
  302. ;;;;
  303. ;;;; Now, install the files.
  304. ;;;;
  305. (if #otherdir
  306.   (
  307.     (installprog)
  308.     (complete 50)
  309.     (copyfiles
  310.     (source #source-dir)
  311.     (dest destination)
  312.     (pattern "(Lib|Demo|Docs|Icons|Modules)")
  313.     (infos)
  314.     )
  315.     (complete 90)
  316.     (copyfiles
  317.     (source (tackon #source-dir "DISCL_and_COPYRIGHT"))
  318.     (dest destination) (infos))
  319.     (copyfiles
  320.     (source (tackon #source-dir "README"))
  321.     (dest destination) (infos))
  322.     (copyfiles
  323.     (source (tackon #source-dir "CHANGES"))
  324.     (dest destination) (infos))
  325.     (copyfiles
  326.     (source (tackon #source-dir "RunTest.py"))
  327.     (dest destination) (infos))
  328.     (copyfiles
  329.     (source (tackon #source-dir "Icons/def_py.info"))
  330.     (dest destination)
  331.     (newname "RunTest.py.info")
  332.     )
  333.  
  334.     (copyfiles
  335.     (source (tackon #source-dir "Icons/Python.info"))
  336.     (dest destination)
  337.     (newname "Python.info")
  338.     )
  339.  
  340.     ;;;; Because we installed to another drawer, the installation files can be removed.
  341.     ;(removeInstallation)    ; Doesn't work: installer still locks drawer
  342.  
  343.   )
  344.   (
  345.     (complete 50)
  346.     (installprog)
  347.     (complete 75)
  348.     (copyfiles
  349.     (source (tackon #source-dir "Icons/Python.info"))
  350.     (dest destination)
  351.     (newname "Python.info")
  352.     )
  353.     (copyfiles
  354.     (source (tackon #source-dir "Icons/def_py.info"))
  355.     (dest destination)
  356.     (newname "RunTest.py.info")
  357.     )
  358.     (run ("delete >NIL: FORCE %s/(python_#?|install#?)" destination))
  359.     (run ("delete >NIL: FORCE %s/Update_Previous#?" destination))
  360.   )
  361. )
  362.  
  363. (complete 95)
  364.  
  365. (startup @app-name
  366.         (prompt (#startupprompt destination))
  367.         (help @startup-help)
  368.         (command ("ASSIGN Python: %s\n" destination))
  369.         (command "PATH Python: ADD\n")
  370. )
  371.  
  372. (run ("ASSIGN >NIL: Python: %s" destination))
  373.  
  374. (if (exists "sys:utilities/multiview")
  375.     (run ("run sys:utilities/multiview %s/%s" destination "DISCL_and_COPYRIGHT") (safe))
  376.     (run (cat "run " pager-cmd) ("%s/%s" destination "DISCL_and_COPYRIGHT") (safe))
  377. )
  378.  
  379. (message #readmemsg)
  380. (message #endmsg)
  381.  
  382. (run "delete >NIL: ram:more FORCE")
  383.  
  384. (complete 100) ; 100% done!
  385.  
  386.